import org.apache.commons.lang3.StringEscapeUtils;
import org.junit.Test;

/**
 * @Description:
 * @Date: 2020/2/10
 * @Time: 15:09
 * @Created by:   dingtao
 * @Modified by:
 * @Modified at:
 */
public class A {

    @Test
    public void test(){
        String a = "'good'test't my\\'ttt";
        System.out.println(a);
//        System.out.println(StringEscapeUtils.escapeJava(a));
        String b = a.replaceAll("\'", "\\\\'");
        System.out.println(b);
        String c = b.replaceAll("\\\\\\\\\'", "\\\\'");
        System.out.println(c);
    }

}
